$(function(){
    //解决手机页面左右滑动问题
    let startX,startY;
    document.addEventListener("touchstart",function(e){
        startX = e.touches[0].pageX; 
        startY = e.touches[0].pageY; 
    });   
    document.addEventListener("touchmove",function(e){
        var moveX = e.touches[0].pageX;
        var moveY = e.touches[0].pageY;
        if(Math.abs(moveX-startX)>Math.abs(moveY-startY)){
            e.preventDefault();
        }
    }, {passive: false});


    let $index = location.href.split("?")[1].split("=")[1];
    let $title = $(".public .header .title");
    let $content = $(".public .content");

    //获取时间
    let date = new Date();
    let nowdate = date.toLocaleDateString();
    let dateArr = nowdate.split("/");
    let month = dateArr[1]<10?"0"+ dateArr[1]:dateArr[1];
    let days = dateArr[2]<10?"0"+ dateArr[2]:dateArr[2];
    function format(){
        let date = new Date();
        let nowdate = date.toLocaleDateString();
        let dateArr = nowdate.split("/");
        let month = dateArr[1]<10?"0"+ dateArr[1]:dateArr[1];
        let days = dateArr[2]<10?"0"+ dateArr[2]:dateArr[2];
        return [date,nowdate,dateArr,month,days]
    }
    let arr = [
        {
            title:"今日课程"
        },
        {
            title:"本周课表"
        },
        {
            title:"预约课程"
        },
        {
            title:"预约记录"
        },
        {
            title:"作业"
        },
        {
            title:"评价老师"
        },
        {
            title:"上课表现"
        },
        {
            title:"剩余课时"
        },
        {
            title:"考试成绩"
        },
        // {
        //     title:"微官网"
        // },
        {
            title:"推荐端"
        },
        {
            title:"我的成长"
        }
    ];
    switch(Number($index)){
        case 0:
        $title.html(arr[$index].title);
        today();
        break;
        case 1:
        $title.html(arr[$index].title);
        week();
        break;
        case 2:
        $title.html(arr[$index].title);
        appoint();
        break;
        case 3:
        $title.html(arr[$index].title);
        log();
        break; 
        case 4:
        $title.html(arr[$index].title);
        homework();
        break;   
        case 5:
        $title.html(arr[$index].title);
        teacher();
        break;   
        case 6:
        $title.html(arr[$index].title);
        show();
        break;   
        case 7:
        $title.html(arr[$index].title);
        surplus();
        break;   
        case 8:
        $title.html(arr[$index].title);
        mark();
        break;   
        case 9:
        $title.html(arr[$index].title);
        center();
        break;   
        case 10:
        $title.html(arr[$index].title);
        growth();
        break;   
        // case 11:
        // $title.html(arr[$index].title);
        // break;                  
    };
    //获取某个月的天数
    function getDaysInOneMonth(y, m){
        m = parseInt(m, 10);
        let d= new Date(y, m, 0);
        return d.getDate();
    }
    //今日课程
    function today(){
        let $classdate = $("<div></div>");
        let $prevdate = $("<span class='day'>上一天</span>");
        let $nowdate = $("<span>1970-01-01</span>");
        let $nextdate = $("<span class='day'>下一天</span>");
        $classdate.css({
            "width":"100%",
            "height":".6rem",
            "text-align":"center",
            "line-height":".6rem",
            "background":"#f1f2f6"
        });
        $classdate.append($prevdate);
        $classdate.append($nowdate);
        $classdate.append($nextdate);
        $content.append($classdate);
        $nowdate.css({
            "margin":"0 .1rem"
        });
        //上下按钮样式
        let $day = $(".public .content span.day");
        $day.css({
            "display":"inline-block",
            "width":".9rem",
            "height":".4rem",
            "background":"#11e1ee",
            "margin-top":".1rem",
            "line-height":".4rem",
            "border-radius":".05rem",
            "color":"#fff"
        });
        //时间
        $nowdate.html(dateArr[0]+'-'+month+'-'+days);
        //上一天
        $prevdate.click(function(){
            days--;
            days=days<10?"0"+days:days;
            if(days<1){
                month--;
                month=month<10?"0"+month:month;
                days=getDaysInOneMonth(dateArr[0], month);
            }
            $nowdate.html(dateArr[0]+'-'+month+'-'+days);
        });
        //下一天
        $nextdate.click(function(){
            days++;
            let totaldays=getDaysInOneMonth(dateArr[0], month);
            if(days>totaldays){
                month++;
                month=month<10?"0"+month:month;
                days=1;
            };
            days=days<10?"0"+days:days;
            $nowdate.html(dateArr[0]+'-'+month+'-'+days);
        });
        //背景图
        let $nodata = $("<div></div>");
        $content.append($nodata);
        $nodata.css({
            "width":"80%",
            "height":"5rem",
            "margin":"0 auto",
            "background":"url(../imgs/index/index_nav_nodata.jpg) center/cover"
        });
        //请假记录
        let $records = $("<div></div>");
        $content.append($records);
        $records.css({
            "position":"fixed",
            "right":".4rem",
            "bottom":"1rem",
            "width":".8rem",
            "height":"1rem",
            "background":"url(../imgs/index/index_nav_log.png) center/cover"
        });
        $records.click(function(){
            $content.html("");
            $title.html("请假记录")
            $content.append($nodata);
            let $back = $(".public .header > a");
            $back.attr("href","");
            $back.click(function(){
                $content.html("");
                today();
            })
        });
    };

    //本周课表
    function week(){
        let $weekdate = $("<div></div>");
        let $prevweek = $("<span class='week'>上一周</span>");
        let $nowweek = $("<span class='week'>本周</span>");
        let $nextweek = $("<span class='week'>下一周</span>");
        let $weektime = $("<div>至</div>");
        let $prevtime = $("<span>1970/01/01</span>");
        let $nexttime = $("<span>2100/12/31</span>");
        let $wholeweek = $("<ul></ul>");
        let $singleday = $(`
        <li>
            <div>
                <p class="weekday">星期一</p>
                <p class="time">08-12</p>
            </div>
            <h2 class="noclass">无课</h2>
        </li>`);
        for(let i=0;i<7;i++){
            $wholeweek.append($singleday.clone());
        }
        $weektime.prepend($prevtime);
        $weektime.append($nexttime);
        $weekdate.append($prevweek);
        $weekdate.append($nowweek);
        $weekdate.append($nextweek);
        $weekdate.append($weektime);
        $content.append($weekdate); 
        $content.append($wholeweek);       
        let $week = $(".public .content div span.week");
        let $dayli = $(".public .content > ul > li");
        $("body").css("background","#fff");
        $weekdate.css({
            "width":"100%",
            "height":"1rem",
            "text-align":"center",
            "background":"#f5f5f5"
        });
        //三个按钮样式
        $week.css({
            "display":"inline-block",
            "width":".8rem",
            "height":".4rem",
            "border":".02rem solid #11e1ee",
            "color":"#11e1ee",
            "border-radius":".05rem",
            "line-height":".4rem",
            "margin-top":".12rem"
        });
        //本周按钮样式
        $nowweek.css({
            "background":"#11e1ee",
            "color":"#fff",
            "margin":"0 .1rem"
        });
        //星期样式
        $wholeweek.css({
            "width":"100%",
            "height":"6.3rem"
        });
        //每一天
        $dayli.css({
            "overflow":"hidden",
            "width":"100%",
            "height":".9rem",
            "border-bottom":"1px solid #ccc"
        });
        $dayli.children("div").css({
            "float":"left",
            "width":"25%",
            "height":".8rem",
            "text-align":"center",
            "padding-top":".1rem",
            "color":"#11e1ee"
        });
        $dayli.children("h2").css({
            "float":"right",
            "width":"70%",
            "height":".9rem",
            "line-height":".9rem",
            "color":"#999"
        });
        //整周时间
        let nowtime = date.getTime();
        let onedaytime = 24*60*60*1000;
        time();
        function time(){
            let day = date.getDay();
            let montime = nowtime - (day-1)*onedaytime;
            let tuetime = nowtime - (day-2)*onedaytime;
            let wedtime = nowtime - (day-3)*onedaytime;
            let thutime = nowtime - (day-4)*onedaytime;
            let fritime = nowtime - (day-5)*onedaytime;
            let sattime = nowtime - (day-6)*onedaytime;
            let suntime = nowtime - (day-7)*onedaytime;
            let monday = new Date(montime).toLocaleDateString();
            let tuesday = new Date(tuetime).toLocaleDateString();
            let wednesday = new Date(wedtime).toLocaleDateString();
            let thursday = new Date(thutime).toLocaleDateString();
            let friday = new Date(fritime).toLocaleDateString();
            let saturday = new Date(sattime).toLocaleDateString();
            let sunday = new Date(suntime).toLocaleDateString();
                //周一
            let mArr = monday.split("/");
            let mMonth = mArr[1]<10?"0"+ mArr[1]:mArr[1];
            let mDays = mArr[2]<10?"0"+ mArr[2]:mArr[2];
                //周二
            let tArr = tuesday.split("/");
            let tMonth = tArr[1]<10?"0"+ tArr[1]:tArr[1];
            let tDays = tArr[2]<10?"0"+ tArr[2]:tArr[2];
                //周三
            let wArr = wednesday.split("/");
            let wMonth = wArr[1]<10?"0"+ wArr[1]:wArr[1];
            let wDays = wArr[2]<10?"0"+ wArr[2]:wArr[2];
                //周四
            let tsArr = thursday.split("/");
            let tsMonth = tsArr[1]<10?"0"+ tsArr[1]:tsArr[1];
            let tsDays = tsArr[2]<10?"0"+ tsArr[2]:tsArr[2];
                //周五
            let fArr = friday.split("/");
            let fMonth = fArr[1]<10?"0"+ fArr[1]:fArr[1];
            let fDays = fArr[2]<10?"0"+ fArr[2]:fArr[2];
                //周六
            let saArr = saturday.split("/");
            let saMonth = saArr[1]<10?"0"+ saArr[1]:saArr[1];
            let saDays = saArr[2]<10?"0"+ saArr[2]:saArr[2];
                //周日
            let sArr = sunday.split("/");
            let sMonth = sArr[1]<10?"0"+ sArr[1]:sArr[1];
            let sDays = sArr[2]<10?"0"+ sArr[2]:sArr[2];
    
    
            $prevtime.html(mArr[0]+'/'+mMonth+'/'+mDays);//周一年月日
            $nexttime.html(sArr[0]+'/'+sMonth+'/'+sDays);//周日年月日
              
            let weeks = ["星期一","星期二","星期三","星期四","星期五","星期六","星期日"];
            let time = [mMonth+'-'+mDays,tMonth+'-'+tDays,wMonth+'-'+wDays,tsMonth+'-'+tsDays,fMonth+'-'+fDays,saMonth+'-'+saDays,sMonth+'-'+sDays];
            $dayli.find("p.weekday").each(function(index){
                $dayli.find("p.weekday").eq(index).html(weeks[index]);
            });
            $dayli.find("p.time").each(function(index1){
                $dayli.find("p.time").eq(index1).html(time[index1]);
            });
        }
        
        //上一周按钮点击事件
        $prevweek.click(function(){
            nowtime-=7*onedaytime;
            time();
        });
        //下一周按钮点击事件
        $nextweek.click(function(){
            nowtime+=7*onedaytime;
            time();
        });
        //本周按钮点击事件
        $nowweek.click(function(){
            nowtime = date.getTime();
            time();
        });
    };

    //预约课程
    function appoint(){
        let $classifi = $("<div><p>普通班</p><p>一对一</p></div>");
        $content.before($classifi);
        $classifi.css({
            "display":"flex",
            "width":"100%",
            "height":".5rem",
            "background":"#fff",
            "border-bottom":"1px solid #ccc"
        });
        $classifi.children("p").eq(0).css({
            "border-right":"1px solid #ccc",
            "background":"#5fffee"
        });
        $classifi.children("p").css({
            "width":"50%",
            "text-align":"center",
            "line-height":".5rem"
        });
        //普通班布局
        let $common = $(`
            <div class="common">
                <div class="select">
                    <select>
                        <option value="0">广州蓝天教育集团</option>
                        <option value="1">XK培训校区</option>
                        <option value="2">YY培训校区</option>
                        <option value="3">YS培训校区</option>
                        <option value="4">CR校区</option>
                        <option value="5">TY培训校区</option>
                        <option value="6">ZJ培训校区</option>
                        <option value="7">MZ培训校区</option>
                        <option value="8">TSET培训校区</option>
                        <option value="9">成都</option>
                    </select>
                    <span contenteditable="true" class="text">教师姓名</span>
                    <span class="button">查询</span>
                </div>
                <div class="date">
                    <span class="prev">前一天</span>
                    <span>1970-01-01</span>
                    <span>后一天</span>
                </div>
                <div class="details">
                    <p>暂无查询结果，</p>
                    <p>请检查是否有课程</p>
                    <p>或者联系老师询问是否已经开启预约功能</p>
                </div>
            </div>
        `);
        $content.append($common);
        //下拉选项样式
        $common.css({
            "width":"100%"
        });
        $common.children(".select").css({
            "position":"relative",
            "width":"100%",
            "height":".4rem"
        });
        $common.find("select").css({
            "width":"36%",
            "height":".36rem",
            "font-size":".16rem",
            "margin":".08rem 0 0 3%",
            "border-radius":".04rem",
            "outline":"none",
            "background":"#fff",
            "vertical-align":"center"
        });
        $common.find(".text").css({
            "position":"absolute",
            "top":".07rem",
            "right":"11%",
            "display":"inline-block",
            "width":"45%",
            "height":".36rem",
            "border-radius":".04rem 0 0 .04rem",
            "border":"1px solid #aaa",
            "border-right":"none",
            "box-sizing":"border-box",
            "font-size":".16rem",
            "text-indent":".15rem",
            "line-height":".36rem",
            "outline":"none",
            "color":"#999",
            "background":"#fff"
        });
        $common.find(".button").css({
            "position":"absolute",
            "top":".07rem",
            "right":"3%",
            "display":"inline-block",
            "width":"8%",
            "height":".36rem",
            "font-size":".16rem",
            "margin-left":"-.1rem",
            "background":"#11e1ee",
            "color":"#fff",
            "line-height":".36rem",
            "border":"1px solid #11e1ee",
            "box-sizing":"border-box",
            "border-radius":"0 .04rem .04rem 0",
            "text-align":"center"
        });
        $common.children(".date").css({
            "display":"flex",
            "width":"100%",
            "height":".6rem",
            "border-top":"1px solid #ccc",
            "border-bottom":"1px solid #ccc",
            "margin-top":".1rem",
            "background":"#fff"
        });
        $common.find(".date > span").css({
            "width":"30%",
            "height":".4rem",
            "text-align":"center",
            "line-height":".4rem",
            "margin":".1rem 1.5%",
            "background":"#11e1ee",
            "color":"#fff",
            "border-radius":".05rem"
        });
        $common.find(".date > span").eq(1).css({
            "background":"#fff",
            "color":"#11e1ee",
            "border":"1px solid #11e1ee",
            "box-sizing":"border-box",
            "line-height":".38rem"
        });
        $common.find(".date > .prev").css({
            "background":"#ccc",
            "color":"#999"
        });
        $common.children(".details").css({
            "width":"100%",
            "text-align":"center"
        });
        //一对一布局
        let $single = $(`
            <div class="single">
                <div>
                    <img src="../imgs/shop/shop_search.png">
                    <span contenteditable="true" class="text">课程名称</span>
                    <span class="button">查询</span>
                </div>
                <div class="detalis"></div>
            </div>
        `);
        $content.append($single);
        $single.css({
            "width":"100%",
            "display":"none"
        });
        $single.children("div").eq(0).css({
            "position":"relative",
            "width":"100%",
            "height":".36rem",
            "background":"#f0f2f5",
            "border-bottom":"1px solid #ccc",
            "padding":".12rem",
            "padding-left":".5rem"
        });
        $single.find("div > img").css({
            "position":"absolute",
            "top":".16rem",
            "left":"8%",
            "width":".3rem",
            "height":".3rem",
            "z-index":"999"
        });
        $single.find(".text").css({
            "position":"absolute",
            "top":".12rem",
            "right":"28%",
            "display":"inline-block",
            "width":"65%",
            "height":".36rem",
            "border-radius":".04rem 0 0 .04rem",
            "border":"1px solid #aaa",
            "border-right":"none",
            "box-sizing":"border-box",
            "font-size":".16rem",
            "text-indent":".4rem",
            "line-height":".36rem",
            "outline":"none",
            "color":"#999",
            "background":"#fff"
        });
        $single.find(".button").css({
            "position":"absolute",
            "top":".12rem",
            "right":"20%",
            "display":"inline-block",
            "width":"8%",
            "height":".36rem",
            "font-size":".16rem",
            "margin-left":"-.1rem",
            "background":"#11e1ee",
            "color":"#fff",
            "line-height":".36rem",
            "border":"1px solid #11e1ee",
            "box-sizing":"border-box",
            "border-radius":"0 .04rem .04rem 0",
            "text-align":"center"
        });
        $single.children("div.detalis").css({
            "width":"100%",
            "height":"5rem",
            "background":"url(../imgs/index/index_nav_nodata.jpg) center/cover"
        });
        //普通班
        $classifi.children("p").eq(0).click(function(){
            $(this).css("background","#5fffee");
            $classifi.children("p").eq(1).css("background","#fff");
            $single.css("display","none");
            $common.css("display","block");
        });
        //一对一
        $classifi.children("p").eq(1).click(function(){
            $(this).css("background","#5fffee");
            $classifi.children("p").eq(0).css("background","#fff");
            $common.css("display","none");
            $single.css("display","block");
        });

        //普通班页面时间点击事件
        $common.find(".date > span").eq(1).html(dateArr[0]+"-"+month+"-"+days);
        //后一天
        $common.find(".date > span").eq(2).click(function(){
            days++;
            $common.find(".date > span").eq(0).css({
                "background":"#11e1ee",
                "color":"#fff"
            });
            let totaldays=getDaysInOneMonth(dateArr[0], month);
            if(days>totaldays){
                month++;
                month=month<10?"0"+month:month;
                days=1;
            };
            days=days<10?"0"+days:days;
            $common.find(".date > span").eq(1).html(dateArr[0]+'-'+month+'-'+days);
        });
        //前一天
        $common.find(".date > span").eq(0).click(function(){
            let dateToday = format();
            let $today = dateToday[2][0]+'-'+dateToday[3]+'-'+dateToday[4];
            let $current = $common.find(".date > span").eq(1).html();
            if(!($current <= $today)){
                days--;
                days=days<10?"0"+days:days;
                if(days<1){
                    month--;
                    month=month<10?"0"+month:month;
                    days=getDaysInOneMonth(dateArr[0], month);
                }
                $common.find(".date > span").eq(1).html(dateArr[0]+'-'+month+'-'+days);
                let $current1 = $common.find(".date > span").eq(1).html();
                if($current1 <= $today){
                    $(this).css({
                        "background":"#ccc",
                        "color":"#999"
                    });
                }
            }    
        });
        //普通班查询输入框
        $common.find(".text").focus(function(){
            if($(this).html()=="教师姓名"){
                $(this).html("");
                $(this).css("color","#000");
            }
            
        });
        $common.find(".text").blur(function(){
            if(!$(this).html()){
                $(this).html("教师姓名");
                $(this).css("color","#999");
            }  
        });
        //一对一查询输入框
        $single.find(".text").focus(function(){
            if($(this).html()=="课程名称"){
                $(this).html("");
                $(this).css("color","#000");
            }
            
        });
        $single.find(".text").blur(function(){
            if(!$(this).html()){
                $(this).html("课程名称");
                $(this).css("color","#999");
            }  
        });
    };

    //预约记录
    function log(){
        let $reservation = $(`
            <div>
                <ul>
                    <li style="background:#5fffee">待审核</li>
                    <li>已通过</li>
                    <li>未通过</li>
                    <li>已取消</li>
                </ul>
            </div>
        `);
        $content.append($reservation);
        week();
        $(".content > ul > li > h2").html("无预约记录");
        //顶部4个导航样式
        $reservation.css("width","100%");
        $reservation.children("ul").css({
            "display":"flex",
            "width":"100%",
            "height":".5rem",
            "border-bottom":"1px solid #ccc"
        });
        $reservation.find("ul > li").css({
            "width":"25%",
            "text-align":"center",
            "line-height":".5rem",
            "text-align":"center",
            "border-right":"1px solid #ccc"
        });
        $reservation.find("ul > li").eq(3).css({
            "border":"none"
        });
        $reservation.find("ul > li").each(function(i){
            $reservation.find("ul > li").eq(i).click(function(){
                $(this).css("background","#5fffee");
                $(this).siblings("li").css("background","#fff");
            });
        });
    };

    //作业
    function homework(){
        let $homedate = $(`
            <div>
                <div class="home-header">
                    <input type="date" value="2014-01-13" style="color:#11e1ee;">
                    <span style="margin:0 .6rem 0 0">至</span>
                    <input type="date" value="2014-01-13" style="color:#11e1ee;margin-right:-.6rem">
                </div>
                <div class="homedata"></div>
            </div>
        `);
        $content.append($homedate);
        $homedate.css({
            "width":"100%"
        });
        $homedate.children(".home-header").css({
            "position":"relative",
            "width":"100%",
            "height":".5rem",
            "background":"#fff",
            "text-align":"center",
            "line-height":".5rem"
        });
        $homedate.children(".homedata").css({
            "width":"100%",
            "height":"5rem",
            "background":"url(../imgs/index/index_nav_nodata.jpg) center/cover"
        });
        $homedate.find(".home-header > input").css({
            "width":"30%",
            "border":"none",
            "outline":"none"
        });
        $homedate.find(".home-header > input").eq(1).val(dateArr[0]+'-'+month+'-'+days);
        //上周时间
        let nowtime = date.getTime();
        let onedaytime = 24*60*60*1000;
        let montime = nowtime - 6*onedaytime;
        let lastweek = new Date(montime).toLocaleDateString();
        let weekArr = lastweek.split("/");       
        let weekmonth = weekArr[1]<10?"0"+ weekArr[1]:weekArr[1];
        let weekdays = weekArr[2]<10?"0"+ weekArr[2]:weekArr[2];
        $homedate.find(".home-header > input").eq(0).val(weekArr[0]+'-'+weekmonth+'-'+weekdays);
    };

    //评价老师
    function teacher(){
        homework();
        let $query = $("<span class='query'>查询</span>");
        $(".content > div .home-header").append($query);
        $(".content > div .home-header").css("background","#f5f5f5");
        $(".content > div .home-header > input").css({
            "border":"1px solid #ccc",
            "float":"left",
            "margin":".05rem .2rem",
            "color":"#999",
            "height":".3rem"
        });
        $(".content > div .home-header > span").css({
            "margin":"0",
            "float":"left"
        });
        $query.css({
            "display":"inline-block",
            "width":".7rem",
            "height":".3rem",
            "margin-top":".08rem",
            "text-align":"center",
            "line-height":".3rem",
            "background":"#11e1ee",
            "border-radius":".04rem",
            "color":"#fff"
        });
    };

    //上课表现
    function show(){
        teacher();
    };

    //剩余课时
    function surplus(){
        let $lesson = $(`
            <div>
                <div class="lesson-title">物理9年级（集体班）</div>
                <ul>
                    <li><img src="../imgs/index/index_nav_lessonhour.png">购买课时：<span>1.00</span></li>
                    <li class="process"><p></p></li>
                    <li><img src="../imgs/index/index_nav_already.png">已上课时：<span>0.00</span></li>
                    <li><img src="../imgs/index/index_nav_friends.png">剩余课时：<span>1.00</span></li>
                    <li><img src="../imgs/me/me_unbind.png">课消金额：<span>0.00</span></li>
                    <li><img src="../imgs/me/me_unbind.png">剩余金额：<span>100.00</span></li>
                </ul>
                <img src="../imgs/shop/shop_brackets.png">
            </div>
        `);
        $content.append($lesson);
        $lesson.css({
            "position":"relative",
            "width":"100%",
            "height":"1.6rem",
            "border-bottom":"1px solid #ccc",
            "background":"#fff"
        });
        $lesson.children(".lesson-title").css({
            "width":"100%",
            "height":".5rem",
            "border-bottom":"1px solid #ddd",
            "line-height":".5rem",
            "font-size":".26rem",
            "text-indent":".15rem"
        });
        $lesson.find("ul > li > img").css({
            "width":".24rem",
            "height":".24rem",
            "margin":"0 .06rem .04rem"
        });
        $lesson.children("ul").css({
            "display":"flex",
            "flex-wrap":"wrap",
            "width":"100%",
            "height":"1.1rem"
        });
        $lesson.children("img").css({
            "position":"absolute",
            "top":".9rem",
            "right":".06rem",
            "transform":"rotate(270deg)"
        });

        $lesson.find("ul > li").css({
            "width":"45%",
            "margin-left":".1rem",
            "color":"#999",
            "font-size":".2rem"
        });
        $lesson.find("ul > li.process > p").css({
            "width":"90%",
            "height":".24rem",
            "background":"#3fb6fd",
            "margin-top":".06rem",
            "border-radius":".12rem"
        });
        $lesson.find("ul > li > span").css("color","#000");
        //课时明细点击事件
        $lesson.children("ul").click(function(){
            $title.html("课时消耗明细");
            $content.empty();
            $content.append("<div class='lesson-info'></div>");
            $content.children(".lesson-info").css({
                "width":"100%",
                "height":"5rem",
                "background":"url(../imgs/index/index_nav_nodata.jpg) center/cover"
            });
            $(".public > .header > a").attr("href","");
            $(".public > .header > a").click(function(){
                surplus();
            });
        });
    };

    //成绩
    function mark(){
        let $mark = $("<div></div>");
        $content.append($mark);
        $mark.css({
            "width":"100%",
            "height":"5rem",
            "background":"url(../imgs/index/index_nav_nodata.jpg) center/cover"
        });
    };

    //推荐中心
    function center(){
        let $center = $(`
            <div class="recommend">
                <div class="today-profit">
                    <ul>
                        <li style="line-height:.8rem">今日收益(元)</li>
                        <li style="line-height:.4rem;"><h1>0.00</h1></li>
                        <li style="line-height:.4rem;margin-top:.3rem">可提现总额(元)</li>
                        <li style="font-size:.28rem">0.00</li>
                    </ul>
                </div>
            </div>
        `);
        let $accumulated = $(`
            <div>
                <div class="acc-title">累计收益<span>0.00</span></div>
                <ul class="acc-list">
                    <li>
                        <img src="../imgs/index/index_nav_recommend.png">
                        <p>我的推荐</p>
                    </li>
                    <li>
                        <img src="../imgs/index/index_nav_cashlog.png">
                        <p>提现记录</p>
                    </li>
                    <li>
                        <img src="../imgs/index/index_nav_commision.png">
                        <p>我的佣金</p>
                    </li>
                    <li>
                        <img src="../imgs/index/index_nav_daren.png">
                        <p>推荐达人</p>
                    </li>
                    <li>
                        <img src="../imgs/index/index_nav_rules.png">
                        <p>推荐规则</p>
                    </li>
                    <li>
                        <img src="../imgs/index/index_nav_cash.png">
                        <p>提现</p>
                    </li>
                    <li>
                        <img src="../imgs/index/index_nav_general.png">
                        <p>普通推广</p>
                    </li>
                    <li>
                        <img src="../imgs/index/index_nav_activity.png">
                        <p>活动推广</p>
                    </li>
                </ul>
            </div>
        `);
        let $trend = $(`
            <div class="trend">
                <div class="trend-title">七日收益走势</div>
                <div class="trend-chart"></div>
            </div>
        `);
        let $thisweek = $(`
            <ul>
                <li>
                    <p></p>
                    <span>星期一</span>
                </li>
                <li>
                    <p></p>
                    <span>星期二</span>
                </li>
                <li>
                    <p></p>
                    <span>星期三</span>
                </li>
                <li>
                    <p></p>
                    <span>星期四</span>
                </li>
                <li>
                    <p></p>
                    <span>星期五</span>
                </li>
                <li>
                    <p></p>
                    <span>星期六</span>
                </li>
                <li>
                    <p style="border-right:1px solid #c0d0e0"></p>
                    <span>今天</span>
                </li>
            </ul>
        `);
        $center.append($accumulated);
        $trend.append($thisweek);
        $center.append($trend);
        $content.append($center);
        //今日收益
        $("html").css("overflow","hidden");
        $("body").css({
            "position":"fixed",
            "top":"0",
            "left":"0",
            "width":"100%",
            "height":"100%",
            "background":"#fff"
        });
        $center.css("width","100%");
        $center.children(".recommend .today-profit").css({
            "width":"100%",
            "height":"2.4rem",
            "background":"#ed5228",
            "background":"-webkit-linear-gradient(top,#f36c26,#ed5228)",
            "color":"#fff",
            "text-align":"center"
        });
        //累计收益
        $accumulated.css({
            "width":"100%",
            "height":"3rem",
            "background":"#fff",
            "border-bottom":"1px solid #ccc"
        });
        $accumulated.children(".acc-title").css({
            "width":"100%",
            "height":".5rem",
            "border-bottom":"1px solid #ccc",
            "line-height":".5rem",
            "font-weight":"bold",
            "text-indent":".1rem",
            "color":"#999"
        });
        $accumulated.find(".acc-title > span").css({
            "float":"right",
            "font-weight":"normal",
            "color":"#ed5228",
            "margin-right":".2rem"
        });
        $accumulated.children(".acc-list").css({
            "display":"flex",
            "flex-wrap":"wrap",
            "width":"100%",
            "height":"2.4rem"
        });
        $accumulated.find(".acc-list > li").css({
            "width":"25%",
            "min-height":"1.1rem",
            "text-align":"center",
            "color":"#999",
            "font-size":".2rem"
        });
        $accumulated.find(".acc-list > li > img").css({
            "width":"35%",
            "margin":".14rem 0 .06rem"
        });
        //七日收益走势
        $trend.css({
            "position":"relative",
            "width":"100%",
            "height":"6rem",
            "background":"#fff",
            "border-top":".2rem solid #f5f5f5"
        });
        $trend.children(".trend-title").css({
            "width":"100%",
            "height":".5rem",
            "line-height":".5rem",
            "font-weight":"bold",
            "text-indent":".1rem",
            "color":"#999",
            "border-top":"1px solid #ccc"
        });
        $trend.children(".trend-chart").css({
            "width":"100%"
        });
        //判断屏幕宽度
        if($(document.body).width() > 800){
            $accumulated.css({
                "height":"3.5rem",
            });
            $accumulated.children(".acc-list").css({
                "height":"2.9rem"
            });
        };
        let echartsContainer = document.querySelector(".content .recommend .trend .trend-chart");
        let resizeEchartsContainer = function () {
            echartsContainer.style.width = window.innerWidth + 'px';
            //echartsContainer.style.height = window.innerHeight + 'px';
            echartsContainer.style.height = "4rem";
            //rem单位
            // echartsContainer.style.width = window.innerWidth/750*690+'px';
            // echartsContainer.style.height = window.innerHeight/750*600+'px';
        };
        //设置容器高宽
        resizeEchartsContainer();

        let trendChart = echarts.init(echartsContainer);
        option = {
            xAxis: {
                type: 'category',
                name:'0',
                nameLocation:'start'
            },
            yAxis: {
                type: 'value',
                show:false
            },
            series: [{
                data: [3, 5, 1, 8, 0, 2, 4],
                type: 'line'
            }]
        };        
        trendChart.setOption(option); 
        //console.log(option.series[0].data)
        window.onresize = function () {
            //重置容器高宽
            resizeEchartsContainer();
            trendChart.resize();
        };
        //星期
        $thisweek.css({
            "display":"flex",
            "position":"absolute",
            "bottom":"0",
            "left":"0",
            "top":"0",
            "right":"0",
            "width":"100%",
            "height":".5rem",
            "margin":"auto",
            "font-size":".16rem"
        });
        $thisweek.children("li").css({
            "width":"11%",
            "font-weight":"lighter",
            "text-align":"center"
        });
        $thisweek.children("li").eq(0).css({
            "margin-left":".6rem"
        });
        $thisweek.find("li > p").css({
            "width":"100%",
            "height":".12rem",
            "border-top":"1px solid #c0d0e0",
            "border-left":"1px solid #c0d0e0"
        });
        //星期更新
        let trendArr = ["星期一","星期二","星期三","星期四","星期五","星期六","星期日",];
        let $trendli= $thisweek.find("li");      
        let today = date.getDay();//0-6
        let trendArr1 = trendArr.concat(trendArr.splice(0,today));//数组组合
        $trendli.each(function(i){
            $trendli.eq(i).children("span").html(trendArr1[i]);
        });
        $trendli.eq(6).children("span").html("今天");
        //累计收益导航栏点击事件
        let $profit = $accumulated.find("ul.acc-list > li");
        let profitArr = ["我的团队","提现记录","我的佣金","推荐排行榜","推荐规则","提现申请","我的二维码","推荐分享"];
        $profit.each(function(index){
            $profit.eq(index).click(function(){
                let num = $(this).index();
                let $back = $(".public .header > a");
                $content.empty();
                $("body").css("background","#fff");
                switch(num){
                    case 0:
                    $title.html(profitArr[num]);
                    $back.attr("href","../pages/index_nav.html?index=9");
                    navRecommend();
                    break;
                    case 1:
                    $title.html(profitArr[num]);
                    $back.attr("href","../pages/index_nav.html?index=9");
                    navCashlog();
                    break;
                    case 2:
                    $title.html(profitArr[num]);
                    $back.attr("href","../pages/index_nav.html?index=9");
                    navCommision();
                    break;
                    case 3:
                    $title.html(profitArr[num]);
                    $back.attr("href","../pages/index_nav.html?index=9");
                    navDaren();
                    break;
                    case 4:
                    $title.html(profitArr[num]);
                    $back.attr("href","../pages/index_nav.html?index=9");
                    navRules();
                    break;
                    case 5:
                    $title.html(profitArr[num]);
                    $back.attr("href","../pages/index_nav.html?index=9");
                    cash();
                    break;
                    case 6:
                    $title.html(profitArr[num]);
                    $back.attr("href","../pages/index_nav.html?index=9");
                    general();
                    break;
                    case 7:
                    $title.html(profitArr[num]);
                    $back.attr("href","../pages/index_nav.html?index=9");
                    activity();
                    break;
                };
            });
        });
        //我的推荐
        function navRecommend(){
            let $recommend = $(`
                <div>
                    <div class="rec-title">
                        <h3 style="width:45%">我的团队</h3>
                        <p style="width:45%;text-align:right;margin-left:4%">共<span style="color:red">0</span>人</p>
                    </div>
                    <ul class="level">
                        <li>一级(<span style="color:red">0</span>人)</li>
                        <li>二级(<span style="color:red">0</span>人)</li>
                        <li>三级(<span style="color:red">0</span>人)</li>
                    </ul>
                    <div class="rec-info"></div>
                </div>
            `);
            $content.append($recommend);
            $recommend.css({
                "width":"100%"
            });
            $recommend.children(".rec-title").css({
                "display":"flex",
                "width":"100%",
                "height":".5rem",
                "line-height":".5rem",
                "padding":"0 2%"
            });
            $recommend.children(".level").css({
                "display":"flex",
                "width":"100%",
                "height":".6rem",
                "border-top":"1px solid #ccc"
            });
            $recommend.find(".level li").css({
                "width":"33.3%",
                "border-right":"1px solid #ccc",
                "line-height":".6rem",
                "text-align":"center",
                "border-bottom":"1px solid #ccc",
            });
            $recommend.find(".level li").eq(0).css({
                "color":"#00aaef",
                "border-bottom":"2px solid #00aaef"
            });
            $recommend.find(".level li").eq(2).css("border-right","none");
            $recommend.children(".rec-info").css({
                "width":"100%",
                "height":"5rem",
                "background":"url(../imgs/index/index_nav_nodata.jpg) center/cover"
            });
            //各级点击事件
            $recommend.find(".level li").each(function(index){
                $recommend.find(".level li").eq(index).click(function(){
                    $(this).css({
                        "color":"#00aaef",
                        "border-bottom":"2px solid #00aaef"
                    });
                    $(this).siblings("li").css({
                        "color":"#000",
                        "border-bottom":"1px solid #ccc"
                    });
                });
            });
        };

        //提现记录
        function navCashlog(){
            let $cashlog = $(`
                <div>
                    <div class="log-title">
                        <p>
                            <img src="../imgs/index/index_nav_center_refresh1.png">
                            <span>申请中</span>
                        </p>
                        <p>
                            <img src="../imgs/index/index_nav_center_done.png">
                            <span>已结算</span>
                        </p>
                    </div>
                    <div class="log-info"></div>
                </div>
            `);
            $content.append($cashlog);
            $cashlog.css("width","100%");
            $cashlog.children(".log-title").css({
                "display":"flex",
                "width":"100%",
                "height":".5rem",
                "border-bottom":"1px solid #ccc"
            });
            $cashlog.find(".log-title > p").css({
                "width":"50%",
                "text-align":"center",
                "line-height":".5rem"
            });
            $cashlog.find(".log-title > p").eq(0).css({
                "color":"#00aaef",
                "border-bottom":"2px solid #00aaef"
            });
            $cashlog.find(".log-title > p > img").css({
                "width":".26rem"
            });
            $cashlog.children(".log-info").css({
                "width":"100%",
                "height":"5rem",
                "background":"url(../imgs/index/index_nav_nodata.jpg) center/cover"
            });
            //申请、结算点击事件
            $cashlog.find(".log-title > p").eq(0).click(function(){
                $(this).css({
                    "color":"#00aaef",
                    "border-bottom":"2px solid #00aaef"
                });
                $(this).siblings("p").css({
                    "color":"#000",
                    "border-bottom":"none"
                });
                $(this).children("img").attr("src","../imgs/index/index_nav_center_refresh1.png");
                $(this).siblings("p").children("img").attr("src","../imgs/index/index_nav_center_done.png");
            });
            $cashlog.find(".log-title > p").eq(1).click(function(){
                $(this).css({
                    "color":"#00aaef",
                    "border-bottom":"2px solid #00aaef"
                });
                $(this).siblings("p").css({
                    "color":"#000",
                    "border-bottom":"none"
                });
                $(this).children("img").attr("src","../imgs/index/index_nav_center_done1.png");
                $(this).siblings("p").children("img").attr("src","../imgs/index/index_nav_center_refresh.png");
            });
        };

        //我的佣金
        function navCommision(){
            let $commision = $(`
                <div>
                    <div class="rec-title">
                        <h3 style="width:45%">我的收益</h3>
                        <p style="width:45%;text-align:right;margin-left:4%">共<span style="color:red">￥0.00</span></p>
                    </div>
                    <ul class="level">
                        <li>一级</li>
                        <li>二级</li>
                        <li>三级</li>
                    </ul>
                    <div class="rec-info"></div>
                </div>
            `);
            $content.append($commision);
            $commision.css({
                "width":"100%"
            });
            $commision.children(".rec-title").css({
                "display":"flex",
                "width":"100%",
                "height":".5rem",
                "line-height":".5rem",
                "padding":"0 2%"
            });
            $commision.children(".level").css({
                "display":"flex",
                "width":"100%",
                "height":".6rem",
                "border-top":"1px solid #ccc"
            });
            $commision.find(".level li").css({
                "width":"33.3%",
                "border-right":"1px solid #ccc",
                "line-height":".6rem",
                "text-align":"center",
                "border-bottom":"1px solid #ccc",
            });
            $commision.find(".level li").eq(0).css({
                "color":"#00aaef",
                "border-bottom":"2px solid #00aaef"
            });
            $commision.find(".level li").eq(2).css("border-right","none");
            $commision.children(".rec-info").css({
                "width":"100%",
                "height":"5rem",
                "background":"url(../imgs/index/index_nav_nodata.jpg) center/cover"
            });
            //各级点击事件
            $commision.find(".level li").each(function(index){
                $commision.find(".level li").eq(index).click(function(){
                    $(this).css({
                        "color":"#00aaef",
                        "border-bottom":"2px solid #00aaef"
                    });
                    $(this).siblings("li").css({
                        "color":"#000",
                        "border-bottom":"1px solid #ccc"
                    });
                });
            });
        };

        //推荐达人
        function navDaren(){
            let $daren = $(`
                <div>
                    <div class="da-title">
                        <p>排行</p>
                        <p style="text-align:right;margin-right:.6rem">佣金</p>
                    </div>
                    <ul class="da-info">
                        <li>
                            <img class="rank" src="../imgs/index/index_nav_center_first.png">
                            <img class="portrait" src="../imgs/me/me_head.gif">
                            <span class="name">赵子铮</span>
                            <span class="money" style="color:#fedf7a">780.00</span>
                        </li>
                        <li>
                            <img class="rank" src="../imgs/index/index_nav_center_second.png">
                            <img class="portrait" src="../imgs/me/me_head.gif">
                            <span class="name">赖彩霞</span>
                            <span class="money" style="color:#c9ced4">300.00</span>
                        </li>
                        <li>
                            <img class="rank" src="../imgs/index/index_nav_center_third.png">
                            <img class="portrait" src="../imgs/me/me_head.gif">
                            <span class="name">郝开心</span>
                            <span class="money" style="color:#fe712f">300.00</span>
                        </li>
                        <li>
                            <span style="font-size:.3rem;margin-left:.34rem;color:#9999b2">4</span>
                            <img class="portrait" src="../imgs/me/me_head.gif">
                            <span class="name">伊伊</span>
                            <span class="money" style="color:#9999b2">300.00</span>
                        </li>
                    </ul>
                </div>
            `);
            $content.append($daren);
            $daren.css("width","100%");
            $daren.children(".da-title").css({
                "display":"flex",
                "width":"100%",
                "height":".3rem",
                "border-bottom":"1px solid #ccc",
                "font-weight":"bold"
            });
            $daren.find(".da-title > p").css({
                "width":"50%",
                "text-indent":".3rem",
                "color":"#999"
            });
            $daren.children(".da-info").css({
                "width":"100%"
            });
            $daren.find(".da-info > li").css({
                "width":"100%",
                "height":".5rem",
                "border-bottom":"1px solid #ccc",
                "line-height":".5rem"
            });
            $daren.find(".da-info > li > .rank").css({
                "width":".3rem",
                "margin-left":".3rem"
            });
            $daren.find(".da-info > li > .portrait").css({
                "width":".45rem",
                "border-radius":"50%",
                "margin":"0 .1rem .05rem .3rem"
            });
            $daren.find(".da-info > li > .portrait").eq(3).css({
                "margin":"0 .1rem .1rem .4rem"
            });
            $daren.find(".da-info > li > .money").css({
                "float":"right",
                "margin-right":".5rem"
            });
            $daren.find(".da-info > li > .name").css({
                "font-size":".16rem"
            });
        };

        //推荐规则
        function navRules(){
            $("body").css({
                "background":"#f5f5f5"
            });
            let $rules = $(`
                <div>
                    <div class="rules-title">
                        <img src="../imgs/index/index_nav_center_rules.png">
                        <span>推荐如何赚钱</span>
                    </div>
                    <ul class="rules-info">
                        <li>
                            <span style="font-size:.24rem;font-weight:bold">第一步:</span>
                            <span>转发物品链接或物品图片给微信好友；</span>
                        </li>
                        <li>
                            <span style="font-size:.24rem;font-weight:bold">第二步:</span>
                            <span>从您转发的链接或图片进入商场的好友，系统将自动锁定成为您的客户，他们在微信商城中购买任意物品，您都可以获得推荐佣金。</span>
                        </li>
                        <li>
                            <span style="font-size:.24rem;font-weight:bold">第三步:</span>
                            <span>您可以在推荐中查看【我的客户】和【推荐订单】。还有确认收货后，佣金可提现。</span>
                        </li>
                        <li>
                            <span style="font-size:.24rem;font-weight:bold">温馨提示:</span>
                            <span>分享后会带有独有的推荐码，您的好友访问之后，系统会自动检测并记录客户关系。如果您的好友已经被其他人抢先发展成了客户，他就不能成为您的客户。以最早发展成为客户为准。</span>
                        </li>
                    </ul>
                </div>
            `);
            $content.append($rules);
            $content.css({
                "padding":".2rem .2rem 0"
            });
            $rules.css({
                "width":"100%",
                "background":"#fff",
                "border":"1px solid #eee",
                "border-radius":".1rem"
            });
            $rules.children(".rules-title").css({
                "width":"100%",
                "height":".5rem",
                "border-bottom":"1px solid #eee",
                "line-height":".5rem",
                "font-size":".24rem",
                "font-weight":"bold"
            });
            $rules.find(".rules-title > img").css({
                "width":".34rem",
                "margin-left":".2rem"
            });
            $rules.children(".rules-info").css({
                "width":"100%",
                "padding":" 0 .2rem"
            });
            $rules.find(".rules-info > li").css({
                "width":"95%",
                "word-wrap":"break-word",
                "color":"#7f7f7f",
                "line-height":".4rem"
            });
        };

        //提现
        function cash(){
            let $cash = $(`
                <div>
                    <div class="cash-application">
                        <p style="line-height:.8rem">可提现金额(元)</p>
                        <h2 style="font-size:.4rem">0.00</h2>
                    </div>
                    <div class="cash-methods" style="width:100%;position:relative">
                        <div class="methods-title">
                            <span>提现方式</span>
                            <span>
                                <img src="../imgs/index/index_nav_brackets.png">
                            </span>
                        </div>
                        <div class="methods-info">
                            <ul>
                                <li>
                                    <img src="../imgs/index/index_nav_center_wechat.png">
                                    <span>微信</span>
                                </li>
                                <li>
                                    <img src="../imgs/index/index_nav_center_alipay.png">
                                    <span>支付宝</span>
                                </li>
                                <li>
                                    <img src="../imgs/index/index_nav_center_bank.png">
                                    <span>银联</span>
                                </li>
                                <li>
                                    <img src="../imgs/index/index_nav_center_cash.png">
                                    <span>现金</span>
                                </li>
                                <li>
                                    <img src="../imgs/index/index_nav_center_balance.png">
                                    <span>转入余额</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="cash-sum">
                        <div class="sum-input">
                            <span>金额：</span>
                            <input type="text" placeholder="请输入提现金额">
                        </div>
                    </div>
                    <div class="cash-certain">确定</div>
                </div>
            `);
            $content.append($cash);
            $("body").css("background","#f5f5f5");
            //可提现金额
            $cash.children(".cash-application").css({
                "width":"100%",
                "height":"1.8rem",
                "background":"#ed5228",
                "background":"-webkit-linear-gradient(top,#f36c26,#ed5228)",
                "color":"#fff",
                "text-align":"center",
                "padding-top":".16rem"
            });
            //提现方式
            $cash.find(".cash-methods .methods-title").css({
                "width":"99%",
                "height":".5rem",
                "border":"1px solid #ccc",
                "margin":"1px",
                "color":"#999",
                "text-indent":".2rem",
                "line-height":".5rem",
                "background":"#fff"
            });
            $cash.find(".cash-methods .methods-title > span").eq(1).css({
                "float":"right",
                "width":".7rem",
                "height":"100%",
                "border-left":"1px solid #ccc"
            });
            $cash.find(".cash-methods .methods-title > span > img").css({
                "width":".4rem",
                "margin-left":"-.05rem"
            });
            $cash.find(".cash-methods .methods-info").css({
                "position":"absolute",
                "top":".54rem",
                "display":"none",
                "width":"99%",
                "border-left":"1px solid #ccc",
                "border-right":"1px solid #ccc",
                "background":"#fff",
                "margin":"0 1px 1px"
            });
            $cash.find(".cash-methods .methods-info > ul > li").css({
                "width":"100%",
                "height":".5rem",
                "border-bottom":"1px solid #ccc",
                "line-height":".5rem",
                "font-size":".18rem"
            });
            $cash.find(".cash-methods .methods-info > ul > li > img").css({
                "width":".4rem",
                "margin":"0 .05rem .05rem .15rem"
            });
            //金额
            $cash.children(".cash-sum").css({
                "width":"100%"
            });
            $cash.find(".cash-sum .sum-input").css({
                "width":"100%",
                "height":".54rem",
                "background":"#fff",
                "margin-top":".06rem",
                "line-height":".5rem",
                "font-weight":"bold",
                "padding-left":".2rem"
            });
            $cash.find(".cash-sum .sum-input input").css({
                "float":"right",
                "width":"85%",
                "line-height":".5rem",
                "border":"none",
                "outline":"none"
            });
            //确定
            $cash.children(".cash-certain").css({
                "position":"fixed",
                "left":"0",
                "bottom":".2rem",
                "width":"84%",
                "height":".5rem",
                "background":"#11e1ee",
                "margin-left":"8%",
                "color":"#fff",
                "font-size":".26rem",
                "font-weight":"bold",
                "line-height":".5rem",
                "text-align":"center",
                "border-radius":".06rem"
            });
            //提现方式下拉事件
            let cashFlag = true;
            $cash.find(".cash-methods .methods-title").click(function(){
                if(cashFlag){
                    $(this).find("span > img").css("transform","rotate(180deg)");
                    $cash.find(".cash-methods .methods-info").css("display","block");
                    cashFlag = false;
                }else{
                    $(this).find("span > img").css("transform","rotate(0)");
                    $cash.find(".cash-methods .methods-info").css( "display","none");
                    cashFlag = true;
                } 
            });
            //具体方式点击事件
            let $cashLi = $cash.find(".cash-methods .methods-info > ul > li");
            $cashLi.each(function(i){
                $cashLi.eq(i).click(function(){
                    $cash.find(".cash-methods .methods-title > span > img").css("transform","rotate(0)");
                    $cash.find(".cash-methods .methods-info").css( "display","none");
                    $cash.find(".cash-methods .methods-title > span").eq(0).html($(this).children("span").html());
                    cashFlag = true;
                    let $account = $cash.find(".cash-sum .sum-input").eq(0).clone();
                    $cash.find(".cash-sum .sum-input").last().siblings(".sum-input").remove();
                    if(i==0){ //微信                      
                        $account.children("span").html("账号：");
                        $account.children("input").attr("placeholder","请输入提现账号");
                        $cash.children(".cash-sum").prepend($account); 
                    }else if(i==1){ //支付宝
                        $account.children("span").html("账号：");
                        $account.children("input").attr("placeholder","请输入提现账号");
                        $cash.children(".cash-sum").prepend($account);
                    }else if(i==2){ //银联
                        $account.children("span").html("账号：");
                        $account.children("input").attr("placeholder","请输入提现账号");
                        $cash.children(".cash-sum").prepend($account);
                        let $account1 = $account.clone();
                        $account1.children("span").html("户名：");
                        $account1.children("input").attr("placeholder","请输入持有人名称");
                        $cash.children(".cash-sum").prepend($account1);
                        let $account2 = $account.clone();
                        $account2.children("span").html("银行名称：");
                        $account2.children("input").attr("placeholder","请输入银行名称");
                        $account2.children("input").css("width","80%");
                        $cash.children(".cash-sum").prepend($account2);
                    };
                });
            });
            //确认按钮
            let alertFlag = true;
            $cash.children(".cash-certain").click(function(){
                let $alert = $("<div>请选择提现方式</div>");
                //弹窗样式
                $alert.css({
                    "position":"absolute",
                    "top":".2rem",
                    "left":"20%",
                    "width":"60%",
                    "height":".4rem",
                    "background":"#d84c31",
                    "color":"#fff",
                    "text-align":"center",
                    "line-height":".4rem",
                    "border-radius":".04rem",
                    "box-shadow":".02rem .02rem .06rem #000"
                });
                //弹窗事件
                let $alertMethods = $cash.find(".cash-methods .methods-title > span").eq(0);
                if(alertFlag){
                    switch($alertMethods.html()){
                        case "提现方式":
                        $content.append($alert);
                        break;
                        case "微信":  
                        $content.append($alert);
                        break;
                    };                   
                    alertFlag = false;
                };              
                setTimeout(function(){
                    $alert.remove();
                    alertFlag = true;
                },2000);
            });
        };

        //普通推广
        function general(){
            $("body").css({
                "background":"#f5f5f5"
            });
            let $code = $(`
                <div>
                    <div class="code-title">
                        <img src="../imgs/index/index_nav_center_codelogo.png">
                        <span>我的二维码</span>
                    </div>
                    <div class="code-info">
                        <h4>分享二维码(长按保存或发送给朋友或对面扫)</h4>
                        <img src="../imgs/index/index_nav_center_code.png">
                    </div>
                </div>
            `);
            $content.append($code);
            $content.css({
                "padding":".2rem .2rem 0"
            });
            $code.css({
                "width":"100%",
                "background":"#fff",
                "border":"1px solid #eee",
                "border-radius":".1rem"
            });
            $code.children(".code-title").css({
                "width":"100%",
                "height":".5rem",
                "border-bottom":"1px solid #eee",
                "line-height":".5rem",
                "font-size":".24rem",
                "font-weight":"bold"
            });
            $code.find(".code-title > img").css({
                "width":".34rem",
                "margin-left":".2rem"
            });
            $code.children(".code-info").css({
                "width":"100%",
                "height":"4rem",
                "padding":" 0 .2rem"
            });
            $code.find(".code-info > img").css({
                "width":"3.2rem",
                "margin":".2rem .2rem .2rem .5rem"
            });
        };

        //推荐分享
        function activity(){
            let $share = $(`
                <div>
                    <div class="share-class">
                        <div class="share-img">
                            <img src="../imgs/index/index_nav_center_shareclass.jpg">
                            <h3 style="padding-top:.2rem">试听课报名</h3>
                            <p style="color:#999">免费试听体验，限时开抢，快来报名吧~<p>
                        </div>
                        <div class="share-code">
                            <span style="border-right:1px solid #ccc"><img src="../imgs/index/index_nav_center_sharecode.png">二维码</span>
                            <span><img src="../imgs/index/index_nav_center_sharelogo.png">分享</span>
                        </div>
                    </div>
                    <div class="share-class">
                        <div class="share-img">
                            <img src="../imgs/index/index_nav_center_shareclass1.jpg">
                            <h3 style="padding-top:.2rem">体验课</h3>
                            <p style="color:#999">乐器体验课<p>
                        </div>
                        <div class="share-code">
                            <span style="border-right:1px solid #ccc"><img src="../imgs/index/index_nav_center_sharecode.png">二维码</span>
                            <span><img src="../imgs/index/index_nav_center_sharelogo.png">分享</span>
                        </div>
                    </div>
                </div>
            `);
            $("body").css("background","#f5f5f5");
            $content.append($share);
            $share.css("width","100%");
            $share.children(".share-class").css({
                "overflow":"hidden",
                "width":"100%",
                "height":"2rem",
                "border":"1px solid #ccc",
                "background":"#fff",
                "margin-bottom":".16rem"
            });
            $share.find(".share-class .share-img").css({
                "width":"100%",
                "height":"1.5rem"
            });
            $share.find(".share-class .share-img > img").css({
                "float":"left",
                "width":"1.2rem",
                "height":"1.2rem",
                "margin":".16rem"
            });
            $share.find(".share-class > .share-code").css({
                "display":"flex",
                "width":"100%",
                "height":".5rem",
                "border-top":"1px solid #ccc"
            });
            $share.find(".share-class > .share-code > span").css({
                "width":"50%",
                "text-align":"center",
                "line-height":".5rem",
                "color":"#999",
                "font-size":".2rem"
            });
            $share.find(".share-class > .share-code > span > img").css({
                "width":".2rem",
                "margin":"-.08rem .06rem 0"
            });
            //二维码
            let $classcode = $("<div><img src='../imgs/index/index_nav_center_classcode1.png'><p>长按二维码可保存到手机或发送给朋友</p></div>");                    
                $classcode.css({
                    "position":"absolute",
                    "top":"0",
                    "left":"0",
                    "width":"100%",
                    "height":"100%",
                    "font-size":".18rem",
                    "text-align":"center",
                    "background":"rgba(0,0,0,.3)"
                });
                $classcode.height($(window).height());
                $classcode.children("img").css({
                    "width":"3rem",
                    "height":"3rem",
                    "margin":"50% auto 0"
                });
                $content.append($classcode);
                $classcode.hide();//二维码隐藏
            let $shareclass = $(".share-class > .share-code > span:nth-child(1)");
            $shareclass.each(function(index){
                //点击不同的课程显示不同的二维码
                $shareclass.eq(index).click(function(){
                    $classcode.children("img").attr("src",`../imgs/index/index_nav_center_classcode${index+1}.png`);
                    $classcode.show();
                    return false;
                });    
            });
            $classcode.parents().click(function(){
                $classcode.hide();
            });
        };
    };

    //我的成长
    function growth(){
        let $header = $(".public .header");
        $header.css({
            
        });
    };
})